package user;

public class User {
    private String name;
    private char sex;
    private int age;
    private String id;
    private String password;
    private String phoneNum;

    public User() {
    }

    public User(String name, char sex, int age, String id, String password, String phoneNum) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.id = id;
        this.password = password;
        this.phoneNum = phoneNum;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setSex(char sex) {
        this.sex = sex;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setPhoneNum(String phoneNum) {
        this.phoneNum = phoneNum;
    }

    public String getName() {
        return name;
    }

    public String getId() {
        return id;
    }

    public char getSex() {
        return sex;
    }

    public int getAge() {
        return age;
    }

    public String getPassword() {
        return password;
    }

    public String getPhoneNum() {
        return phoneNum;
    }

    @Override
    public String toString() {
        return "用户\n" +
                "姓名：" + name +
                "\tid:" + id +
                "\t性别：" + sex +
                "\t年龄：" + age +
                "\t密码：" + password +
                "\t手机号：" + phoneNum;
    }

    public boolean equals(Object obj) {//判断是否为同一个对象
        if (this == obj) {//为同一个对象
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        User other = (User) obj;
        return name.equals(other.name);
    }
}
